package cn.edu.zafu.bigdata.lhff;

public class Course {
    private final String courseName;
    private final String courseCode;
    private final String teacherName;
    private final int credits;

    public Course(String courseName, String courseCode, String teacherName, int credits) {
        if (credits < 0) {
            throw new IllegalArgumentException("学分不为负数.");
        }
        this.courseName = courseName;
        this.courseCode = courseCode;
        this.teacherName = teacherName;
        this.credits = credits;
    }

    public void printInfo() {
        System.out.println("课程名称: " + courseName);
        System.out.println("课程代码: " + courseCode);
        System.out.println("教师: " + teacherName);
        System.out.println("学分: " + credits);
    }

    public static void main(String[] args) {
        Course course = new Course("JAVA面向对象程序设计", "C3502033", "吴老师", 4);
        course.printInfo();
    }
}
